<template>
  <hb-card>
    <view class="intro">
      <view class="intro-item">
        <view>
          <text class="intro-item-title">{{$t("coin")}}</text>
          <text class="intro-item-value">{{data.coin}}</text>
        </view>
        <view>
          <text class="intro-item-title">{{$t("orderId")}}</text>
          <text class="intro-item-value">{{data.id}}</text>
        </view>
      </view>
      <view class="intro-item">
        <view>
          <text class="intro-item-title">{{$t("info.number")}}</text>
          <text class="intro-item-value amount">{{Number(data.amount)}} {{data.coin}}</text>
        </view>
        <view>
          <text class="intro-item-title">{{$t("info.state")}}</text>
          <text class="intro-item-value success" v-if="data.status == 'Success'">{{$t("info.success")}}</text>
          <text class="intro-item-value failure" v-else-if="data.status == 'Failure'">{{$t("info.fail")}}</text>
          <text class="intro-item-value waiting" v-else>{{$t("info.wait")}}</text>
        </view>
      </view>
      <view class="intro-item">
        <view @click="addressCopy(data.txid)">
          <text class="intro-item-title">{{$t("my.charge.hash")}}</text>
          <text class="intro-item-value">{{data.txid}}</text>
		  <image src="@/static/my/copy.png" mode="" class="copy"></image>
        </view>
      </view>
      <view class="intro-item">
        <view>
          <text class="intro-item-title">{{$t("info.time")}}</text>
          <text class="intro-item-value">{{data.created_at}}</text>
        </view>
      </view>
    </view>
  </hb-card>
</template>

<script>
import HbNumberBox from "@/components/hb-number-box";
import HbCard from "../../../../components/hb-card";
export default {
  name: "record-item",
  components: {HbCard, HbNumberBox},
  props: {
    data: {
      default: {},
      type: Object
    }
  },
  methods: {
    addressCopy(text) {
      uni.setClipboardData({
        data: text,
        success: function () {
          uni.showToast({
            icon: 'success'
          })
        },
        fail: function () {
          uni.showToast({
            icon: 'fail'
          })
        }
      });
    }
  }
}
</script>

<style scoped lang="scss">
  .intro {
    margin-top: 12rpx;
    &-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 24rpx;
      &-title {
        font-size: 28rpx;
        color: $hb-text-color;
      }
      &-value {
        font-weight: 700;
        font-size: 28rpx;
        color: $hb-title-color;
        margin-left: 12rpx;
        word-break:break-all;
      }
      .copy {
        color: $hb-primary-color;
        font-size: 24rpx;
        margin-left: 10rpx;
		width:25rpx;
		height:25rpx;
      }
      .coin {
        color: $hb-primary-color;
      }
      .amount {
        color: $hb-primary-color;
      }
      .success {
        color: $hb-success-color;
      }
      .failure {
       color: $hb-red;
      }
      // .waiting {
      //   color: $hb-info-color;
      // }
    }
  }
</style>
